package com.hgkj.cloud.base.service.impl;

import com.hgkj.cloud.base.common.PageInfo;
import com.hgkj.cloud.base.dao.TenantQuestionnaireTaskInfoMapper;
import com.hgkj.cloud.base.domain.TenantQuestionnaireTaskInfo;
import com.hgkj.cloud.base.service.TenantQuestionnaireTaskInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class TenantQuestionnaireTaskInfoServiceImpl implements TenantQuestionnaireTaskInfoService {

    @Autowired
    private TenantQuestionnaireTaskInfoMapper tenantQuestionnaireTaskInfoMapper;

    @Override
    public int deleteByPrimaryKey(Long id) {
        return tenantQuestionnaireTaskInfoMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int insert(TenantQuestionnaireTaskInfo record) {
        return tenantQuestionnaireTaskInfoMapper.insert(record);
    }

    @Override
    public int insertSelective(TenantQuestionnaireTaskInfo record) {
        return tenantQuestionnaireTaskInfoMapper.insertSelective(record);
    }

    @Override
    public TenantQuestionnaireTaskInfo selectByPrimaryKey(Long id) {
        return tenantQuestionnaireTaskInfoMapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateByPrimaryKeySelective(TenantQuestionnaireTaskInfo record) {
        return tenantQuestionnaireTaskInfoMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(TenantQuestionnaireTaskInfo record) {
        return tenantQuestionnaireTaskInfoMapper.updateByPrimaryKey(record);
    }

    @Override
    public int deleteQnTaskInfo(Map<String, Object> map) {
        return tenantQuestionnaireTaskInfoMapper.deleteQnTaskInfo(map);
    }

    @Override
    public List<TenantQuestionnaireTaskInfo> listQnTaskInfoByMap(Map<String, Object> map) {
        return tenantQuestionnaireTaskInfoMapper.listQnTaskInfoByMap(map);
    }

    @Override
    public TenantQuestionnaireTaskInfo findFinishedQnTask(Map<String, Object> map) {
        return tenantQuestionnaireTaskInfoMapper.findFinishedQnTask(map);
    }

    @Override
    public List<Map<String, Object>> listPageQnTaskInfos(PageInfo pi, Map<String, Object> map) {
        if(pi != null){
            map.put("currentCount", pi.getCurrentCount());
            map.put("pageSize", pi.getPageSize());
        }
        return tenantQuestionnaireTaskInfoMapper.listPageQnTaskInfos(map);
    }

    @Override
    public int listPageQnTaskInfosCount(Map<String, Object> map) {
        return tenantQuestionnaireTaskInfoMapper.listPageQnTaskInfosCount(map);
    }

    @Override
    public List<TenantQuestionnaireTaskInfo> listAllQnTaskInfos(Map<String, Object> map) {
        return tenantQuestionnaireTaskInfoMapper.listAllQnTaskInfos(map);
    }

    @Override
    public List<TenantQuestionnaireTaskInfo> listCheckQnTaskInfos(Long task_id) {
        return tenantQuestionnaireTaskInfoMapper.listCheckQnTaskInfos(task_id);
    }

    @Override
    public int countQTaskFinishedUsers(Long task_id) {
        return tenantQuestionnaireTaskInfoMapper.countQTaskFinishedUsers(task_id);
    }

    @Override
    public List<Map<String, Object>> listWarningCounts(Map<String, Object> map) {
        return tenantQuestionnaireTaskInfoMapper.listWarningCounts(map);
    }

    @Override
    public int listAllCountsbyQnId(Map<String, Object> map) {
        return tenantQuestionnaireTaskInfoMapper.listAllCountsbyQnId(map);
    }

    @Override
    public List<Map<String, Object>> listWarningUsers(PageInfo pi, Map<String, Object> map) {
        if(pi != null){
            map.put("currentCount", pi.getCurrentCount());
            map.put("pageSize", pi.getPageSize());
        }
        return tenantQuestionnaireTaskInfoMapper.listWarningUsers(map);
    }

    @Override
    public int listWarningUsersCount(Map<String, Object> map) {
        return tenantQuestionnaireTaskInfoMapper.listWarningUsersCount(map);
    }

    @Override
    public List<Map<String, Object>> listUsersByParameter(PageInfo pi, Map<String, Object> map) {
        if(pi != null){
            map.put("currentCount", pi.getCurrentCount());
            map.put("pageSize", pi.getPageSize());
        }
        return tenantQuestionnaireTaskInfoMapper.listUsersByParameter(map);
    }

    @Override
    public List<Map<String, Object>> listFinishUserAndTaskInfo( PageInfo pi,Map<String, Object> map) {
        if(pi != null){
            map.put("currentCount", pi.getCurrentCount());
            map.put("pageSize", pi.getPageSize());
        }
        return tenantQuestionnaireTaskInfoMapper.listFinishUserAndTaskInfo(map);
    }

    @Override
    public int listUsersByParameterCount(Map<String, Object> map) {
        return tenantQuestionnaireTaskInfoMapper.listUsersByParameterCount(map);
    }

    @Override
    public long listFinishUserAndTaskInfoCount(Map<String, Object> map) {
        return tenantQuestionnaireTaskInfoMapper.listFinishUserAndTaskInfoCount(map);
    }

    @Override
    public int listJoinQnTaskInfosCount(Map<String, Object> map) {
        return tenantQuestionnaireTaskInfoMapper.listJoinQnTaskInfosCount(map);
    }

    @Override
    public List<Map<String, Object>> statMonthQnTaskInfo(Map<String, Object> map) {
        return tenantQuestionnaireTaskInfoMapper.statMonthQnTaskInfo(map);
    }

    @Override
    public List<Map<String, Object>> frameworkScoreStatistics(Map<String, Object> map) {
        return tenantQuestionnaireTaskInfoMapper.frameworkScoreStatistics(map);
    }

    @Override
    public List<Map<String, Object>> frameworkScoreStatisticsUser(PageInfo pageInfo,Map<String, Object> map) {
        if(pageInfo != null){
            map.put("currentCount", pageInfo.getCurrentCount());
            map.put("pageSize", pageInfo.getPageSize());
        }
        return tenantQuestionnaireTaskInfoMapper.frameworkScoreStatisticsUser(map);
    }

    @Override
    public List<Map<String, Object>> subjectOptionStatistics(Map<String, Object> map) {
        return tenantQuestionnaireTaskInfoMapper.subjectOptionStatistics(map);
    }

    @Override
    public List<Map<String, Object>> subjectOptionStatisticsUser(PageInfo pageInfo,Map<String, Object> map) {
        if(pageInfo != null){
            map.put("currentCount", pageInfo.getCurrentCount());
            map.put("pageSize", pageInfo.getPageSize());
        }
        return tenantQuestionnaireTaskInfoMapper.subjectOptionStatisticsUser(map);
    }

    @Override
    public int getUserQuestionnaireTaskInfoFinishedCount(Map<String, Object> map) {
        return tenantQuestionnaireTaskInfoMapper.getUserQuestionnaireTaskInfoFinishedCount(map);
    }
}
